﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace LinearAlgebra
{
    public partial class OrthagonalBasisForm : Form
    {
        private static Keys[] acceptableKeys = { Keys.Back, Keys.Escape, Keys.Delete, Keys.Home, Keys.End };
        Random rng = new Random( );

        public OrthagonalBasisForm()
        {
            InitializeComponent();
        }
        private void Back_Click(object sender, EventArgs e)
        {
            Close();
        }
        private void OrthagonalBasisForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            SelectionForm form = new SelectionForm();
            form.Location = this.Location;
            form.Show();
        }
        private void FloatInput(object sender, KeyEventArgs e)
        {
            if (UtilityMethods.ValidateFloatKeyEvent((TextBox)sender, e))
                Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            float v1 = float.Parse(V1.Text);
            float v2 = float.Parse(V2.Text);


            if(v1 == 0 && v2 == 0)
            {
                ZeroBasisDialog dialog = new ZeroBasisDialog();
                dialog.Show();
                return;
            }
            OrthagonalBasisDialog form = new OrthagonalBasisDialog(v1, v2);
            form.Show();
        }

        private void Randomize_Click(object sender, EventArgs e)
        {
            RandomizeValues();
        }
        private void RandomizeValues()
        {
            V1.Text = UtilityMethods.GetRandomNumberString(20);
            V2.Text = UtilityMethods.GetRandomNumberString(20);            
        }
        
    }
}
